//																		//
//	Programming Methodologies Lab (14:332:254)							//
//	Laboratory C - Chapter 5: Control Statements, Part 2				//
//																		//
//	Eric Lee															//
//	Section: 3															//
//	2/9/12																//
//																		//
/************************************************************************/
// Lab C: IntegerAverage.cpp
// Calculate the average of several integers.

#include <iostream>
using std::cin;
using std::cout;
using std::endl;

int main()
{
   int value = 0;
   int count = 0;
   int total;

   cout << "Enter integers (9999 to end):" << endl;
   cin >> value;

   for( total = 0; value != 9999; )
   {
	   total += value;
	   count++;
	   cin >> value;
   }

   if ( count != 0 )
      cout << "\nThe average is: " << static_cast<double>(total) / count << endl;
   else
      cout << "\nNo values were entered." << endl;
   cin.get();
   cin.get();
   return 0;
}